package com.ylq.impl;

import com.ylq.dao.UserRolesDao;
import com.ylq.service.UserRolesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author qiang
 * @Description TODO
 * @Date 2020-04-29
 **/
@Service
public class UserRolesServiceImpl implements UserRolesService{
    @Autowired
    private UserRolesDao urDao;

    @Override
    public int deleteUr(String userid) {
        return urDao.deleteUr(userid);
    }

    @Override
    public int addUserToRole(String uId, String[] rId) {
        int for1 = 0;
        for (String rIds: rId){
             for1 =urDao.addUserToRole(uId,rIds);
        }
        return for1;
    }

    @Override
    public int removeUserFromRole(String uId, String[] rId) {
        int for1 = 0;
        for (String rIds: rId){
            for1 =urDao.removeUserFromRole(uId,rIds);
        }
        return for1;
    }
}
